//
//  BaseViewController.h
//  T21info
//
//  Created by 陈区 on 12-10-30.
//  Copyright (c) 2012年 陈区. All rights reserved.
//  项目中所有的ViewControoler的基类
//

#import <UIKit/UIKit.h>
//#import "CMTabBarController.h"

@interface BaseViewController : UIViewController
{
    UIView *m_titleView;//自定义导航栏标题
    UILabel *m_lbTitle;//自定义导航栏标题里的标签
    //CMTabBarController *m_tabBarController;
    BOOL   isPresentModelView;
    CGFloat heightScrollView;
}
/**
 左侧按钮宽度 用于计算标题位置
 */
@property (nonatomic, assign) CGFloat leftBarbuttonWidth;
/**
 标题字符串，解决title从外部无法传入问题
 */
@property (nonatomic, copy)NSString *titleString;

/**
 埋点名称字符串
 */
@property (nonatomic, copy)NSString *objName;

@property(nonatomic,strong) UIView *tempBgView;//记录控件的bgMainView 这样直接获取不需要调用[vc.view viewWithTag]方法,在baseViewController调用.view方法会初始化，导致控件数据丢失

//@property(nonatomic,assign)CMTabBarController *tabBarController;

//导航栏左侧显示返回按钮
- (void)showCustomNavigationBackButton;

//导航栏左侧显示绿色返回按钮
- (void)showCustomNavigationGreedBackButton:(NSString *)imageNorName withPreImage:(NSString *)imagePreName;

//设置导航条背景颜色
-(void)setNavigationBarBackgroudImage:(NSString *) imageName withIos7name:(NSString *)imageName2;

//显示导航栏左侧的按钮
- (void)showCustomNavigationLeftButtonWithTitle:(NSString *)aTitle image:(UIImage *)aImage hightlightImage:(UIImage *)hImage;

//显示导航栏右边两个按钮
//显示导航栏右边两个按钮
- (void)showCustomNavigationRightButtonWithimage:(UIImage*)aImage hightlightImage:(UIImage*)hImage image2:(UIImage*)aImage2 hightlightImage2:(UIImage*)hImage2;
- (void)showCustomNavigationRightButtonWithTitle:(NSString*)aTitle Withimage:(UIImage*)aImage hightlightImage:(UIImage*)hImage image2:(UIImage*)aImage2 hightlightImage2:(UIImage*)hImage2;

//显示导航栏右边的按钮
- (void)showCustomNavigationRightButtonWithTitle:(NSString *)aTitle image:(UIImage *)aImage hightlightImage:(UIImage *)hImage;
- (void)showCustomNavigationRightButtonWithTitle:(NSString*)aTitle image:(UIImage*)aImage hightlightImage:(UIImage*)hImage color:(UIColor*)color;
- (void)showTwoRightButtonWithTitle:(NSString *)aTitle1 image1:(UIImage *)aImage1 hightlightImage1:(UIImage *)hImage1
                             title2:(NSString *)aTitle2 image2:(UIImage *)aImage2 hightlightImage1:(UIImage *)hImage2;

//显示导航栏下边带文字的按钮
- (void)showCustomNavigationRightButtonWithDownTitle:(NSString *)aTitle image:(UIImage *)aImage hightlightImage:(UIImage *)hImage;
- (void)showCustomNavigationLeftButtonWithDownTitle:(NSString *)aTitle image:(UIImage *)aImage hightlightImage:(UIImage *)hImage;

//显示导航栏右边的按钮（可设置颜色）
- (void)showCustomNavigationRightButtonWithColorTitle:(NSString *)aTitle image:(UIImage *)aImage hightlightImage:(UIImage *)hImage titleColor:(UIColor *)color;

//显示导航栏左边的按钮（可设置颜色）
- (void)showCustomNavigationLeftButtonWithColorTitle:(NSString *)aTitle image:(UIImage *)aImage hightlightImage:(UIImage *)hImage titleColor:(UIColor *)color;

//隐藏右边导航按钮
- (void)hideNavigationRightButtonWithColorTitle;

//判断相机权限
- (void)judgeCameraAuthorizationStatus;

//保存屏幕图片
- (UIImage *)saveScreenShotImage:(UIView *)aview;

//保存与读取缓存内的图片
-(NSData *)saveServiceImage:(NSURL *)url;

-(NSData *)saveServiceImage:(NSURL *)url imageView:(UIImageView *)imageView;

//获取字的高度
- (float) heightForString:(NSString *)value fontSize:(float)fontSize andWidth:(float)width;

//时间计算
-(NSString*)showDate:(NSString*)dateStr;

-(BOOL)CheckLoginAlertView;



/**
 *  键盘按钮
 *
 *  @return 返回视图
 */
-(UIView *)onKeyBoardFinishedButton;

-(void)onShowDefaultImage:(UIView *)view;

-(void)onHideDefaultImage:(UIView *)view;

//字符串日期转时间整型
-(NSString *)onChangeStrToDate:(NSString *)dateStr;


/**
 *  显示图片
 *
 *  @param picArray 图片组
 *  @param index    滚动到当前图
 */
-(void)showMorePic:(NSArray *)picArray indexPic:(NSInteger)index;

-(void)showMorePic:(NSArray *)picArray indexPic:(NSInteger)index ImageView:(UIImageView *)ImageView;

//数值转换
-(NSString *)onChangeValueType:(id)objStr;


/**
 *  正则表达式
 *  @param textString 输入字符串
 *  @param code       正则表达式
 *  @return YES匹配  NO不匹配
 */
-(BOOL)isExpressCode:(NSString *)textString expressStr:(NSString *)code;

/**
 字典转json
 */
- (NSDictionary *)dictionaryWithJsonString:(NSString *)jsonString;

/**
 数组转json
 */
- (NSArray *)arrayWithJsonString:(NSString *)jsonString;

/**
 数值转换
 */
-(NSInteger)onChangeIntegerValueType:(id)objStr;

/**
 *  上传图片自动转了90度
 */
- (UIImage *)fixOrientation:(UIImage *)aImage;

-(void)imageView:(UIImageView*)imageView setImageUrl:(NSURL*)url defaultImage:(UIImage*)image;

//检查网络
-(BOOL)checkNetWork;
@end
